const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('sunnyFootMenuMaterial', {
    id: {
      autoIncrement: true,
      type: DataTypes.BIGINT,
      allowNull: false,
      primaryKey: true,
      comment: "ID"
    },
    footMenuId: {
      type: DataTypes.BIGINT,
      allowNull: false,
      comment: "菜单ID",
      field: 'foot_menu_id'
    },
    name: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "材料名称"
    },
    unit: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "材料量"
    },
    img: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "图片链接"
    },
    createUser: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "创建人",
      field: 'create_user'
    },
    createTime: {
      type: DataTypes.DATE,
      allowNull: true,
      comment: "创建时间",
      field: 'create_time'
    },
    updateUser: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "修改人",
      field: 'update_user'
    },
    updateTime: {
      type: DataTypes.DATE,
      allowNull: true,
      comment: "修改时间",
      field: 'update_time'
    },
    deleteTime: {
      type: DataTypes.INTEGER,
      allowNull: false,
      comment: "是否已删除",
      field: 'delete_time'
    }
  }, {
    sequelize,
    tableName: 'sunny_foot_menu_material',
    timestamps: true,
    createdAt: 'createTime',
    updatedAt: 'updateTime',
    deletedAt: 'deleteTime',
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "id" },
        ]
      },
    ]
  });
};
